<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        //1、数组结构
        let arr = [1,2,3];
        //es6之前只能通过下标进行获取数组的值,es6可以这样:
        const [x,y,z] = arr;//x,y,z将与arr中的每个位置对应来取值
        //然后打印
        console.log(x,y,z)

        //2、对象结构
        const person = {
            name:"jack",
            age:21,
            language:['java','js','css']
        }
        //结构表达式取值，将person里面每个属性和做左边对应赋值
        const{name,age,language} = person;
        //可以分别打印
        console.log(name)
        console.log(age)
        console.log(language)

        //扩展：如果想要将name的值赋值给其他变量，可以如下，
        const{name: nn,age,language} = person;
        console.log(nn)
        console.log(age)
        console.log(language)
    </script>
</head>
<body>
    
</body>
</html>